Class 6 Assignment | Map Projections

Goode Homolosine Projection (equal area - often used in Rand McNally atlas)

Source: https://pubs.er.usgs.gov/publication/pp1453

Concepts & Themes:

This week’s assignment will encompass the following concepts covered in Class 6 lecture & lab:

  • Overview of Map Projections
  • Small Scale vs. Large Scale mapping techniques for Map Projections
  • Project projections (project properties) vs. layer projection operations
  • ‘On-the-fly’ transformation capacities in QGIS
  • Measurements & Areal calculations based on CRS parameters

Specific techniques covered this week will include:

  • Defining Projections
  • Reprojecting
  • Datum Transformations
  • Angular units vs. planar units

Class 6 Readings:

This week’s readings will include 1 section from the Essentials of Geographic Information Systems textbook; further, the supplemental technical readings cover best approaches to choosing and using map projections.

The class 6 quiz will cover only content from the Essentials of Geographic Information Systems textbook as follows:

Class 6 Supplemental Readings

Readings:

  1. Radical Cartography - Bill Rankin Projection Charts (folder of PDFs)
  2. Chapter 3 - Map Projections
  3. Choosing a projection
  4. Chapter 9 ‘what projection should I use’
  5. An Album of map projections - John P. Snyder

Assignment Steps:

  • Assignment Preamble:

In this assignment, you will create 1 map deliverable, but the assignment will be divided into two components - first a projection exercise for UTM; second, the mapping product deliverable itself.

The map delieverable will include the reprojection of vector features derived from OpenStreetMap. CRS parameters for WGS84 will be transformed to an appropriate UTM Zone for an global city. In this way, the ‘shape’ of the city and accurate areal measurements will be gained. The dominating land use type will be offset from other land use types. A plugin tool Group Stats will be used to sum multiple polygons for land use totals.

  • The UTM System:

UTM Zones

Source: http://earth-info.nga.mil/GandG/coordsys/grids/universal_grid_system.html

Part I Exploring the UTM map projection:

Project CRS Properties - Initial Search for correct UTM Zone

  • Second, the UTM projection will be visible as slightly curved grid, similar to the following image:

UTM Overlay to Land Features

Note: Task 5 utilizes UTM zones based on the NAD83 datum. In Part II, we will utilize the UTM zone system, but will use the WGS84 datum. Both are perfectly acceptable. NAD83 is used primarily for geographies in North America, whereas WGS84 datum is appropriate for geographies worldwide. If your chosen location for Task 5 above is outside the contiguous US, UTM in the WGS84 datum is best.

Below note that when the search term is utm 18, several versions of UTM are returned, including NAD83 and WGS84. Note also that there are S options and N options. Since UTM runs perpendicular to the equator, any location south of the equator fall in the S options and those north fall in the N options:

QGIS CRS Filter

Part II - Large Scale Mapping with UTM Zone Projection:

  • To start, we will utilize OSM OpenStreetMap data - specifically land uses within cities - to understand the value of map projections for large scale mapping. The OSM data will be delivered in WGS84 - a Geodetic Coordinate System, not Projected Coordinate System. In this assignment, the GCS will be transformed to a PCS - WGS84 to UTM - to gain more accurate areal representation, and importantly gain a planar map unit unlike the angular unit of WGS84 - a world geodetic coordinate system with decimal degrees as its map unit.

  • Step 1: Navigate to bbbike.org which features city extracts from the OSM dataset. These extracts are updated daily and feature 200 cities in total.

    • Select 1 of 200 cities as subject city:

bbbike.org City Extracts

  • From the listed options, download the ESRI .shp zipped option for chosen city OSM data (Aarhus will be utilized as the demonstration):

OSM Extract Options per City

  • Utilize the landuse.shp as the input data for the map development:

Landuse .shp

  • Next, overlay the landuse features to the C6 Asgmt 6 Data - Part II - UTM Zones. Detect which UTM zone your city intersects. In the following image, the city Aarhus intersects with zone 32, adjacent to zone 33 to the east:

OSM Landuse with UTM zone overlay

  • Step 2: Reproject your city land use polygons to their intersect UTM zone. Here zone 32 north is selected upon export of the aarhus_landuse feature layer. First, right-click > export > save feature as > navigate to the CRS button to the far right:

Select CRS Icon

  • Select the intersect UTMzone:

QGIS CRS Selector

  • Export the feature to an exports folder that you create. Open a new .qgs and discard the current .qgs project:

Save Vector Layer as… will embed new CRS into the export feature

  • Step 3: Open a new .qgs and immediately import the projected feature for landuse. Note the ‘shape’ difference from the unprojected WGS84 instance of the same landuse features. Here the shape of the data is much more upright. Check the project CRS in the lower right of the Map Canvas - it should inherit the properties of the layer and show the EPSG code for the layer UTM zone:

Landuse in QGIS Map Canvas

  • Using Field Calculator, derive sq. area. Since UTM features a map unit in meters, the return column value will also be in meters (refer to Class 4 & 5 sq. area procedures). Alternatively, utilize Vector > Geometry Tools > Add Geometry Attributes:

Add Geometry Attributes

  • Since the layer and project CRS are now exactly the same, either can be used to determine the new geometry attributes. Since landuse are polygons, an areal attribute will be added, and the units will be those of the layer/project attributes. UTM will always feature meters as planar unit, so the square area returned will be sq. meters:

Geometry Attributes can abide by either project or layer CRS

  • Step 4: Given that OSM data is not necessarily designed for spatial analysis, there will very likely be invalid geometries present in the dataset. These can either be repaired or they can be dropped. There are several tools to utilize within QGIS.

Invalid Geometry Error/Warning

  • First, try to repair the features. Processing Toolbox > Fix Geometries:

Fix Geometries vis Processing Toolbox

  • Tool input:

Fix Geometries vis Processing Toolbox

  • Check results:

Fix Geometries vis Processing Toolbox

  • Return to the geometry task; utilize Vector > Geometry Tools > Add Geometry Attributes within the new temporary layer Fixed geometries. The result will be Added geom info which will now have the necessary sq. areal unit (sq meters):

Resulting Feature with Added Geometry Attributres

  • Step 5: Install and deploy the Group Stats plugin:

Group Stats Plugin Tool

  • Develop a summary table wherein landuse types are summarized as sum of total sq. area (meters). To enact, populate the tool as follows using the Added geom info temporaray layer as the input. Note variable population at bottom of tool panel:

Group Stats Plugin Tool

  • Results will include a table of land uses in the feature layer and their summed areas. Sort the table high to low and focus on the largest land use - residential in the case of Aarhus below:

Group Stats Plugin Tool

  • Highlight the largest land use and Copy selected to clipboard:

Copy Values to Clipboard

  • Open a text editor (wordpad, TextEdit, ect.) and paste the largest land use. This will result in the value stripped of its scientific notation. Divide this number using the following equation to achieve the total square kilometers of the largest land use in the OSM representation of your city choice:

Note: UTM map units are meters thus to derive sq. km the formula is:

km² =m²/1000000

Resulting Predominant Landuse and m²

  • Step 6: With the total sq. kilometers derived for the largest land use in your city per the OSM dataset, this value can be used in your final map design. Keep it saved as .txt for your cartographic design; its not necessary for the next process.

  • Within the Group Stat tool with the largest land use highlighted, Show selected on map (this creates a selection in the attribute table of all land use polygons that fit into the largest land use category):

Select via Group Stat Plugin

  • Note the selected residential land use features:

Selected Landuse Features

  • Step 7: With the largest land use features selected, open the attribute table and create a new field as an integer type - code. Make sure to populate the calculator as shown:

Code the predominant Landuse Features with Code = 1

  • The result will be a new field code with a integer 1 added to only those records that are part of the largest land use type. All other values result as NULL.

Result

  • Invert the selection so that the NULL values are now selected. These new selections are all polygons that are not of the type of the largest land use:

Invert Selection

  • Return to the Field Calculator and repeat the process, but this time choose to update the code field and enter integer 2:

Inverted Selection as Code =2

  • Review the resulting field; for each record there now should be either a 1 or 2 value under the code field. Return to Map Canvas. Toogle OFF editing and save the edits. Deselect all features so there are no yellow hightlights in the feature layer. Next, export Added geom info as a .shp titled city_name_landuse.shp:

Save Feature with the new UTM CRS

  • Step 8: The code variable is now ready to map, resulting in a categorical thematic map for the largest land use type vs all other land uses in the selected city:

Categorical Symbolization on Code Integer Value

  • Save the project, and pivot to the cartographic design of the final map. See the map examples for general map layout expectations. Include the following:

  • Legend designed for the categorical land use types - the dominant land use vs all other land uses

  • Map titling

  • Data attribution and author tag (data from OpenStreetMap)

  • Thematic map design corresponding to the map legend

  • Final Note:

  • As OpenStreetMap is an open-source, community effort - not designed exclusively for GIS analysis - there are typically more ‘mistakes’ in the dataset than data published by public agencies and private companies/corporations. If you see obviously incorrect map features, you may want to remove those features before running Group Stat and deriving final mapping outputs. For instance, there is a very long and narrow polygon within the Aarhus data that should probably be removed as its likely a mistake. It does not appear to follow the larger pattern of the city, and it interrupts many polygons unnaturally. To remove a feature, first choose a selection mode from the Tool Menu:

Select Features Tool

  • Next, zoom to the candidate feature for removal and use the tool to highlight just the feature alone:

Selected Feature - narrow, elongated features in OSM are often mistakes in the dataset

  • Open the attribute table and Move selection to top:

Selection Moved to Top of Attribute Table

  • Next, Toogle editing mode ON:

Toogle Edit Mode

  • Next, Delete selected features:

Selected Feature Deleted

  • Finally, Toggle Editing OFF. The feature will now be removed:

‘cleaned’ Resulting Feature

Optional Map Addition - insert CRS into print composer map page:

Utilize the following code and steps to insert a layer CRS text into final map design in print composer.

  • Create a custom function in text item properties:

    • “Insert an expression”, and type the following function in the Function Editor tab: Code:
from qgis.core import *
from qgis.gui import *

@qgsfunction(args='auto', group='Custom')
def get_crs(layer_name, feature, parent):
    return QgsProject.instance().mapLayersByName(layer_name)[0].crs().description()
  • Click on “Load”

  • In the the Expression tab, type:

get_crs( 'your_layer_name' )

Note: If this optional step proves cumbersome, the CRS can simply be placed as a text item into the final map layout. The advantage of utilizing functions in QGIS layout is reproducible results that are coded into the layout document. This optional step in the assignment allows you to practice this capacity in QGIS layout design.

Video Guides:

  • Optional Map Addition - CRS insertion to Print Composer:

Print CRS

Deliverable: Produce the assignment map at 11“x17” PDF. Make sure to produce legend items, source tag and titling. No need for north arrow; however, a scale bar can be an effective for this mapping. Upload PDF map export to the assignment location for Class 6 Assignment.

Further Reference:

EPSG Geodetic Parameter Dataset